package com.mxpio.erp.common.plm.vo;

import com.mxpioframework.jpa.annotation.DictAble;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.persistence.Transient;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@Data
@Schema(description = "项目任务成员工时")
public class ProjectPeopletime implements Serializable, DictAble {
    private static final long serialVersionUID=1L;

    @Schema(description = "成员")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String name;

    @Schema(description = "汇总正常工时")
    private BigDecimal normalWorkTime;

    @Schema(description = "汇总加班工时")
    private BigDecimal overtimeWorkTime;

    @Transient
    private Map<String, String> textMap;

    public ProjectPeopletime(String name, BigDecimal normalWorkTime, BigDecimal overtimeWorkTime) {
        this.name = name;
        this.normalWorkTime = normalWorkTime;
        this.overtimeWorkTime = overtimeWorkTime;
    }

    public String putText(String key, String value) {
        if (textMap == null) {
            textMap = new HashMap<>();
        }
        return textMap.put(key, value);
    }
}
